const fs = require('fs')
// 为了解决回调地狱,resolve,reject也是方法。resolve和reject是形参，可以随意写
function my_readFile(fileName) {
    fs.readFile(fileName, 'utf8', (error, data) => {
        if (error != null) {
            console.log('读取失败');
            console.log(error);
        }
        console.log('读取成功！');
        console.log(data);
    })
}

async function runAsync() {
    let asyncRes1 = await my_readFile('test1.txt')
    let asyncRes2 = await my_readFile('test2.txt')
    let asyncRes3 = await my_readFile('test3.txt')
    console.log(asyncRes1);
    console.log(asyncRes2);
    console.log(asyncRes3);
}
runAsync()
